home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / parsed / mdelim.frm < prev    next >
Text File  |  1995-05-02  |  8KB  |  284 lines

  1. VERSION 2.00
  2. Begin Form frmMultiDelim 
  3.    Caption         =   "Parse Demo - Parse Test With Multiple Character Delimiter"
  4.    ClientHeight    =   4605
  5.    ClientLeft      =   915
  6.    ClientTop       =   1200
  7.    ClientWidth     =   8130
  8.    Height          =   5010
  9.    Left            =   855
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4605
  12.    ScaleWidth      =   8130
  13.    Top             =   855
  14.    Width           =   8250
  15.    Begin CommandButton cmdSwitch 
  16.       Caption         =   "&Switch"
  17.       FontBold        =   0   'False
  18.       FontItalic      =   0   'False
  19.       FontName        =   "MS Sans Serif"
  20.       FontSize        =   8.25
  21.       FontStrikethru  =   0   'False
  22.       FontUnderline   =   0   'False
  23.       Height          =   315
  24.       Left            =   6960
  25.       TabIndex        =   21
  26.       Top             =   105
  27.       Width           =   975
  28.    End
  29.    Begin CommandButton cmdClear 
  30.       Caption         =   "&Clear"
  31.       FontBold        =   0   'False
  32.       FontItalic      =   0   'False
  33.       FontName        =   "MS Sans Serif"
  34.       FontSize        =   8.25
  35.       FontStrikethru  =   0   'False
  36.       FontUnderline   =   0   'False
  37.       Height          =   285
  38.       Left            =   7515
  39.       TabIndex        =   18
  40.       Top             =   1020
  41.       Width           =   555
  42.    End
  43.    Begin CommandButton cmdLoadEx 
  44.       Caption         =   "&Load Example"
  45.       Height          =   330
  46.       Left            =   195
  47.       TabIndex        =   17
  48.       Top             =   1500
  49.       Width           =   3090
  50.    End
  51.    Begin TextBox txtFullString 
  52.       Height          =   285
  53.       Left            =   1200
  54.       TabIndex        =   3
  55.       Tag             =   "txtFullString"
  56.       Top             =   1035
  57.       Width           =   6270
  58.    End
  59.    Begin TextBox txtDelim 
  60.       Height          =   285
  61.       Left            =   1200
  62.       TabIndex        =   1
  63.       Top             =   630
  64.       Width           =   1095
  65.    End
  66.    Begin CommandButton cmdParse 
  67.       Caption         =   "&Parse"
  68.       Height          =   330
  69.       Left            =   3615
  70.       TabIndex        =   4
  71.       Top             =   1500
  72.       Width           =   3750
  73.    End
  74.    Begin Label lblCurRoutine 
  75.       FontBold        =   -1  'True
  76.       FontItalic      =   -1  'True
  77.       FontName        =   "MS Sans Serif"
  78.       FontSize        =   9.75
  79.       FontStrikethru  =   0   'False
  80.       FontUnderline   =   0   'False
  81.       Height          =   405
  82.       Left            =   2610
  83.       TabIndex        =   20
  84.       Top             =   120
  85.       Width           =   4185
  86.    End
  87.    Begin Label Label3 
  88.       Caption         =   "Current Routine:"
  89.       Height          =   270
  90.       Left            =   240
  91.       TabIndex        =   19
  92.       Top             =   120
  93.       Width           =   2235
  94.    End
  95.    Begin Label lblString 
  96.       BorderStyle     =   1  'Fixed Single
  97.       Height          =   270
  98.       Index           =   11
  99.       Left            =   4155
  100.       TabIndex        =   16
  101.       Top             =   3990
  102.       Width           =   3000
  103.    End
  104.    Begin Label lblString 
  105.       BorderStyle     =   1  'Fixed Single
  106.       Height          =   270
  107.       Index           =   10
  108.       Left            =   4155
  109.       TabIndex        =   15
  110.       Top             =   3615
  111.       Width           =   3000
  112.    End
  113.    Begin Label lblString 
  114.       BorderStyle     =   1  'Fixed Single
  115.       Height          =   270
  116.       Index           =   9
  117.       Left            =   4155
  118.       TabIndex        =   14
  119.       Top             =   3240
  120.       Width           =   3000
  121.    End
  122.    Begin Label lblString 
  123.       BorderStyle     =   1  'Fixed Single
  124.       Height          =   270
  125.       Index           =   8
  126.       Left            =   4155
  127.       TabIndex        =   13
  128.       Top             =   2850
  129.       Width           =   3000
  130.    End
  131.    Begin Label lblString 
  132.       BorderStyle     =   1  'Fixed Single
  133.       Height          =   270
  134.       Index           =   7
  135.       Left            =   4155
  136.       TabIndex        =   12
  137.       Top             =   2460
  138.       Width           =   3000
  139.    End
  140.    Begin Label lblString 
  141.       BorderStyle     =   1  'Fixed Single
  142.       Height          =   270
  143.       Index           =   6
  144.       Left            =   4155
  145.       TabIndex        =   11
  146.       Top             =   2100
  147.       Width           =   3000
  148.    End
  149.    Begin Label lblString 
  150.       BorderStyle     =   1  'Fixed Single
  151.       Height          =   270
  152.       Index           =   5
  153.       Left            =   855
  154.       TabIndex        =   9
  155.       Top             =   3990
  156.       Width           =   3000
  157.    End
  158.    Begin Label lblString 
  159.       BorderStyle     =   1  'Fixed Single
  160.       Height          =   270
  161.       Index           =   4
  162.       Left            =   855
  163.       TabIndex        =   10
  164.       Top             =   3615
  165.       Width           =   3000
  166.    End
  167.    Begin Label lblString 
  168.       BorderStyle     =   1  'Fixed Single
  169.       Height          =   270
  170.       Index           =   3
  171.       Left            =   855
  172.       TabIndex        =   8
  173.       Top             =   3225
  174.       Width           =   3000
  175.    End
  176.    Begin Label lblString 
  177.       BorderStyle     =   1  'Fixed Single
  178.       Height          =   270
  179.       Index           =   2
  180.       Left            =   855
  181.       TabIndex        =   7
  182.       Top             =   2835
  183.       Width           =   3000
  184.    End
  185.    Begin Label lblString 
  186.       BorderStyle     =   1  'Fixed Single
  187.       Height          =   270
  188.       Index           =   1
  189.       Left            =   855
  190.       TabIndex        =   6
  191.       Top             =   2460
  192.       Width           =   3000
  193.    End
  194.    Begin Label lblString 
  195.       BorderStyle     =   1  'Fixed Single
  196.       Height          =   270
  197.       Index           =   0
  198.       Left            =   855
  199.       TabIndex        =   5
  200.       Top             =   2100
  201.       Width           =   3000
  202.    End
  203.    Begin Label Label2 
  204.       Caption         =   "&Full String:"
  205.       Height          =   255
  206.       Left            =   210
  207.       TabIndex        =   2
  208.       Top             =   1050
  209.       Width           =   930
  210.    End
  211.    Begin Label Label1 
  212.       Caption         =   "&Delimiter:"
  213.       Height          =   255
  214.       Left            =   210
  215.       TabIndex        =   0
  216.       Top             =   630
  217.       Width           =   900
  218.    End
  219. End
  220.  
  221. Sub cmdClear_Click ()
  222.    txtFullString = ""
  223.    txtFullString.SetFocus
  224. End Sub
  225.  
  226. Sub cmdLoadEx_Click ()
  227.    txtDelim = "|delim|"
  228.    txtFullString = "This|delim|is|delim|a test of|delim|ParseAndFillArray|delim|routine."
  229.    cmdParse.SetFocus
  230. End Sub
  231.  
  232. Sub cmdParse_Click ()
  233.    Dim numelements%, i%
  234.    Dim TheString$, Delim$
  235.    Dim DynArray$()
  236.  
  237.    Screen.MousePointer = HOURGLASS
  238.    'clear out labels
  239.    For i% = 0 To 11
  240.       lblString(i%) = ""
  241.    Next i%
  242.    'allow them to clear
  243.    DoEvents
  244.  
  245.    TheString$ = txtFullString
  246.    Delim$ = txtDelim
  247.    
  248.     'call the appropriate function
  249.    If lblCurRoutine = "ParseAndFillArray1%()" Then
  250.       numelements% = ParseAndFillArray1%(TheString$, Delim$, DynArray$())
  251.    Else
  252.       numelements% = ParseAndFillArray2%(TheString$, Delim$, DynArray$(), 10)
  253.    End If
  254.    
  255.    'set max of 12 string parts for sake of example
  256.    If numelements% > 12 Then
  257.       numelements% = 12
  258.    End If
  259.    
  260.    'put elements into labels
  261.    For i% = 1 To numelements%
  262.       lblString(i% - 1) = DynArray$(i%)
  263.    Next i%
  264.    Screen.MousePointer = HOURGLASS
  265. End Sub
  266.  
  267. Sub cmdSwitch_Click ()
  268.    'toggle to other available routine
  269.    If lblCurRoutine = "ParseAndFillArray1%()" Then
  270.       lblCurRoutine = "ParseAndFillArray2%()"
  271.    Else
  272.       lblCurRoutine = "ParseAndFillArray1%()"
  273.    End If
  274. End Sub
  275.  
  276. Sub Form_Activate ()
  277.    Screen.MousePointer = DEFAULT
  278. End Sub
  279.  
  280. Sub Form_Unload (Cancel As Integer)
  281.    End
  282. End Sub
  283.  
  284.